﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BrokerBase.Lib.Policy;

namespace BrokerBase.Lib.Product.AdjustRateConverter
{
    public class TimeUnitAdjConverter :AbstractAdjustRateConverter
    {

        public override string Name
        {
            get { return "付款方式"; }
        }

        public override double GetCoefficient(IPolicy policy, IAdjustRateItem selectedItem)
        {
            return policy.SelectedTimeUnit.Coefficient * selectedItem.Value;
        }

        public override IList<IAdjustRateItem> GetDefaultItems()
        {
            IList<IAdjustRateItem> items = new List<IAdjustRateItem>();

            foreach (var v in Owner.Owner.PaymentCycles)
            {
                IAdjustRateItem adj = new AdjustRateItem(Owner);

                adj.Name = v.Name;
                adj.Value = 1d;

                items.Add(adj);
            }

            return items;
        }

    }
}
